package a10_StreamIO;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;

/**
 * @Author quan
 * @Description TODO
 * @Date 2023/5/24 17:25
 */
public class a07_PrintWriter {
    public static void main(String[] args) throws FileNotFoundException {
        //1、创建一个输出流
        FileOutputStream outputStream = new FileOutputStream("D:/hello.txt");
        //2、根据输出流，创建一个PrintWriter对象
        PrintWriter printWriter = new PrintWriter(outputStream);
        //3、写入文件
        printWriter.println("今天星期三");
        printWriter.println("今天星期四");
        printWriter.println("今天星期五");
        //4、强制刷新缓冲区
        printWriter.flush();
        //5、关闭流
        printWriter.close();
    }
}
